import os
import shutil

path = './problem2_files'
os.mkdir(path + '/documents')
os.mkdir(path + '/images')

img_suffix = ['png','gif','jpg']
doc_sufix = ['doc','docx','ppt','md']

for i in img_suffix:
    curent_path = path + '/' + i
    files = os.listdir(curent_path)
    for f in files:
        shutil.move(curent_path+'/'+f,'./problem2_files/images')
    os.removedirs(curent_path)

for d in doc_sufix:
    curent_path = path+'/'+d
    files = os.listdir(curent_path)
    for f in files:
        shutil.move(curent_path+'/'+f,'./problem2_files/documents')
    os.removedirs(curent_path)